package com.example.fufudamowang.music;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button B1=(Button) findViewById(R.id.B1);
        B1.setOnClickListener(new OnClickListener_start());
        Button B2=(Button) findViewById(R.id.B2);
        B2.setOnClickListener(new OnClickListener_stop());

    }

    public class OnClickListener_start implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            startService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
        }
    }

    public class OnClickListener_stop implements View.OnClickListener{

        @Override
        public void onClick(View v) {
            stopService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
            finish();
        }
    }

}
